package com.zhuss.controller.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.company.CreateCompanyBo;
import com.zhuss.bean.bo.core.company.CreateDeptBo;
import com.zhuss.bean.bo.core.company.DeleteCompanyBo;
import com.zhuss.bean.bo.core.company.DeleteDeptBo;
import com.zhuss.bean.bo.core.company.UpdateCompanyBo;
import com.zhuss.bean.bo.core.company.UpdateDeptBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.core.company.CompanyOperateServiceExt;
import com.zhuss.exception.AabException;


/**
 * 公司操作 controller
 * @Author zhushanshuo
   @Date 2020-02-04 22:58
 *
 */
  
 
@RestController
@RequestMapping("/company")
public class CompanyOperateController extends BaseController {
	
	@Autowired
	@Qualifier("companyOperateService")
	private OperateService<Void, Object> companyOperateService;
	
	@Autowired
	@Qualifier("companyOperateServiceExt")
	private CompanyOperateServiceExt companyOperateServiceExt;
	
	/**
	 * 创建
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateCompanyBo bo) throws AabException {
		
		companyOperateService.create(bo);
    }
	
	
	/**
	 * 修改
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateCompanyBo bo) throws AabException {
		
		companyOperateService.update(bo);
    }
	
	/**
	 * 删除
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteCompanyBo bo) throws AabException {
		
		companyOperateService.delete(bo);
    }
	
	
	/**
	 * 创建部门
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/createDept")
    public void createDept(@RequestBody CreateDeptBo bo) throws AabException {
		
		companyOperateServiceExt.createDept(bo);
    }
	
	
	/**
	 * 修改部门
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/updateDept")
    public void updateDept(@RequestBody UpdateDeptBo bo) throws AabException {
		
		companyOperateServiceExt.updateDept(bo);
    }
	
	/**
	 * 删除部门
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/deleteDept")
    public void deleteDept(@RequestBody DeleteDeptBo bo) throws AabException {
		
		companyOperateServiceExt.deleteDept(bo);
    }



	
}
